// pages/order/order.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show: false,
    minDate: new Date().getTime(),
    maxDate: new Date(2030, 1, 1),
    currentDate: '',
    formatter(type, value) {
      if (type === 'year') {
        return `${value}年`;
      } else if (type === 'month') {
        return `${value}月`;
      }
      return value;
    },
    goodsList: [{
      title: "土豆",
      desc: "规格: 1kg/箱",
      price: "8.00",
      oprice: "10.00",
      num: 999,
      tag: "自营",
      imgUrl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1564119746662&di=4691acd3bcac355e6d26f4c388bf5edf&imgtype=0&src=http%3A%2F%2Fimage02.71.net%2Fimage02%2F97%2F51%2F39%2F96%2Fc825651b-fda7-40b3-9ce8-1c178ec01e15.jpg"
    }, {
      title: "土豆",
      desc: "规格: 1kg/箱",
      price: "8.00",
      oprice: "10.00",
      num: 999,
      tag: "自营",
      imgUrl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1564119746662&di=4691acd3bcac355e6d26f4c388bf5edf&imgtype=0&src=http%3A%2F%2Fimage02.71.net%2Fimage02%2F97%2F51%2F39%2F96%2Fc825651b-fda7-40b3-9ce8-1c178ec01e15.jpg"
    }]
    
},
format(time){
  var Y = new Date(time).getFullYear()
  var M = new Date(time).getMonth() + 1
  var D = new Date(time).getDate()
  return Y + '-' + M + '-' + D
},
  onConfirm(e){
    var t = this.format(e.detail)
    this.setData({
      currentDate: t,
      show: false
    })
  },
  onCancel(){
    this.setData({
      show: false
    })
  },
  showpopup: function () {
    if (!this.show) {
      this.setData({
        show: true
      })
    } else {
      this.setData({
        show: false
      })
    }
  },
  onClickButton:function(){
   wx.navigateTo({
     url: '/pages/shoppingCart/orderCompletion/index'
   });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var t=this.format(new Date())
    this.setData({
      currentDate: t
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})